﻿@model CustomerSettingsModel
<script>
    $(document).ready(function () {
        $("#@Html.IdFor(model => model.CustomerSettings.DateOfBirthEnabled)").click(toggleCustomerRequiredFormField);
        $("#@Html.IdFor(model => model.CustomerSettings.DateOfBirthRequired)").click(toggleCustomerRequiredFormField);
        $("#@Html.IdFor(model => model.CustomerSettings.CountryEnabled)").click(toggleCustomerCountryFormField);
        $("#@Html.IdFor(model => model.CustomerSettings.StateProvinceEnabled)").click(toggleCustomerStateProvinceFormField);
        $("#@Html.IdFor(model => model.CustomerSettings.CompanyEnabled)").click(toggleCustomerRequiredFormField);
        $("#@Html.IdFor(model => model.CustomerSettings.StreetAddressEnabled)").click(toggleCustomerRequiredFormField);
        $("#@Html.IdFor(model => model.CustomerSettings.StreetAddress2Enabled)").click(toggleCustomerRequiredFormField);
        $("#@Html.IdFor(model => model.CustomerSettings.ZipPostalCodeEnabled)").click(toggleCustomerRequiredFormField);
        $("#@Html.IdFor(model => model.CustomerSettings.CityEnabled)").click(toggleCustomerRequiredFormField);
        $("#@Html.IdFor(model => model.CustomerSettings.PhoneEnabled)").click(toggleCustomerRequiredFormField);
        $("#@Html.IdFor(model => model.CustomerSettings.FaxEnabled)").click(toggleCustomerRequiredFormField);
        $("#@Html.IdFor(model => model.CustomerSettings.NewsletterEnabled)").click(toggleNewsletterEnabledField);
        $("#@Html.IdFor(model => model.CustomerSettings.HideNewsletterBlock)").click(toggleHideNewsletterBlock);

        toggleCustomerCountryFormField();
        toggleCustomerStateProvinceFormField();
        toggleCustomerRequiredFormField();
        toggleNewsletterEnabledField();
        toggleHideNewsletterBlock();
    });

    function toggleCustomerCountryFormField() {
        if ($('#@Html.IdFor(model => model.CustomerSettings.CountryEnabled)').is(':checked')) {
            $('#pnlCustomerCountryRequired').show();
            $('#pnlCustomerStateProvinceEnabled').show();
            toggleCustomerStateProvinceFormField();
        } else {
            $('#pnlCustomerCountryRequired').hide();
            $('#pnlCustomerStateProvinceEnabled').hide();
            toggleCustomerStateProvinceFormField();
        }
    }

    function toggleCustomerStateProvinceFormField() {
        if ($('#@Html.IdFor(model => model.CustomerSettings.CountryEnabled)').is(':checked') &&
            $('#@Html.IdFor(model => model.CustomerSettings.StateProvinceEnabled)').is(':checked')) {
            $('#pnlCustomerStateProvinceRequired').show();
        } else {
            $('#pnlCustomerStateProvinceRequired').hide();
        }
    }

    function toggleCustomerRequiredFormField() {
        if ($('#@Html.IdFor(model => model.CustomerSettings.DateOfBirthEnabled)').is(':checked')) {
            $('#pnlCustomerDateOfBirthRequired').show();
        } else {
            $('#pnlCustomerDateOfBirthRequired').hide();
        }

        if ($('#@Html.IdFor(model => model.CustomerSettings.DateOfBirthEnabled)').is(':checked') &&
            $('#@Html.IdFor(model => model.CustomerSettings.DateOfBirthRequired)').is(':checked')) {
            $('#pnlDateOfBirthMinimumAge').show();
        } else {
            $('#pnlDateOfBirthMinimumAge').hide();
        }

        if ($('#@Html.IdFor(model => model.CustomerSettings.CompanyEnabled)').is(':checked')) {
            $('#pnlCustomerCompanyRequired').show();
        } else {
            $('#pnlCustomerCompanyRequired').hide();
        }

        if ($('#@Html.IdFor(model => model.CustomerSettings.StreetAddressEnabled)').is(':checked')) {
            $('#pnlCustomerStreetAddressRequired').show();
        } else {
            $('#pnlCustomerStreetAddressRequired').hide();
        }

        if ($('#@Html.IdFor(model => model.CustomerSettings.StreetAddress2Enabled)').is(':checked')) {
            $('#pnlCustomerStreetAddress2Required').show();
        } else {
            $('#pnlCustomerStreetAddress2Required').hide();
        }

        if ($('#@Html.IdFor(model => model.CustomerSettings.ZipPostalCodeEnabled)').is(':checked')) {
            $('#pnlCustomerZipPostalCodeRequired').show();
        } else {
            $('#pnlCustomerZipPostalCodeRequired').hide();
        }

        if ($('#@Html.IdFor(model => model.CustomerSettings.CityEnabled)').is(':checked')) {
            $('#pnlCustomerCityRequired').show();
        } else {
            $('#pnlCustomerCityRequired').hide();
        }

        if ($('#@Html.IdFor(model => model.CustomerSettings.PhoneEnabled)').is(':checked')) {
            $('#pnlCustomerPhoneRequired').show();
        } else {
            $('#pnlCustomerPhoneRequired').hide();
        }

        if ($('#@Html.IdFor(model => model.CustomerSettings.FaxEnabled)').is(':checked')) {
            $('#pnlCustomerFaxRequired').show();
        } else {
            $('#pnlCustomerFaxRequired').hide();
        }
    }

    function toggleNewsletterEnabledField() {
        if ($('#@Html.IdFor(model => model.CustomerSettings.NewsletterEnabled)').is(':checked')) {
            $('#pnlCustomerNewsletterTickedByDefault').show();
        } else {
            $('#pnlCustomerNewsletterTickedByDefault').hide();
        }
    }

    function toggleHideNewsletterBlock() {
        if ($('#@Html.IdFor(model => model.CustomerSettings.HideNewsletterBlock)').is(':checked')) {
            $('#pnlNewsletterBlockAllowToUnsubscribe').hide();
        }
        else {
            $('#pnlNewsletterBlockAllowToUnsubscribe').show();
        }
    }

</script>
<div class="form-horizontal">
<div class="form-body">
<div class="form-group">
    <div class="note note-info">
        @Loc["Admin.Settings.Customer.CustomerFormFields.Description"]
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.FirstLastNameRequired" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.FirstLastNameRequired"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.FirstLastNameRequired"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.GenderEnabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.GenderEnabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.GenderEnabled"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.DateOfBirthEnabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.DateOfBirthEnabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.DateOfBirthEnabled"></span>
    </div>
</div>
<div class="form-group" id="pnlCustomerDateOfBirthRequired">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.DateOfBirthRequired" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.DateOfBirthRequired"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.DateOfBirthRequired"></span>
    </div>
</div>
<div class="form-group" id="pnlDateOfBirthMinimumAge">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.DateOfBirthMinimumAge" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <admin-input asp-for="CustomerSettings.DateOfBirthMinimumAge"/>
        <span asp-validation-for="CustomerSettings.DateOfBirthMinimumAge"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.CompanyEnabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.CompanyEnabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.CompanyEnabled"></span>
    </div>
</div>
<div class="form-group" id="pnlCustomerCompanyRequired">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.CompanyRequired" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.CompanyRequired"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.CompanyRequired"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.StreetAddressEnabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.StreetAddressEnabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.StreetAddressEnabled"></span>
    </div>
</div>
<div class="form-group" id="pnlCustomerStreetAddressRequired">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.StreetAddressRequired" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.StreetAddressRequired"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.StreetAddressRequired"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.StreetAddress2Enabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.StreetAddress2Enabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.StreetAddress2Enabled"></span>
    </div>
</div>
<div class="form-group" id="pnlCustomerStreetAddress2Required">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.StreetAddress2Required" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.StreetAddress2Required"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.StreetAddress2Required"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.ZipPostalCodeEnabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.ZipPostalCodeEnabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.ZipPostalCodeEnabled"></span>
    </div>
</div>
<div class="form-group" id="pnlCustomerZipPostalCodeRequired">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.ZipPostalCodeRequired" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.ZipPostalCodeRequired"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.ZipPostalCodeRequired"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.CityEnabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.CityEnabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.CityEnabled"></span>
    </div>
</div>
<div class="form-group" id="pnlCustomerCityRequired">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.CityRequired" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.CityRequired"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.CityRequired"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.CountryEnabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.CountryEnabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.CountryEnabled"></span>
    </div>
</div>
<div class="form-group" id="pnlCustomerCountryRequired">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.CountryRequired" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.CountryRequired"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.CountryRequired"></span>
    </div>
</div>
<div class="form-group" id="pnlCustomerStateProvinceEnabled">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.StateProvinceEnabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.StateProvinceEnabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.StateProvinceEnabled"></span>
    </div>
</div>
<div class="form-group" id="pnlCustomerStateProvinceRequired">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.StateProvinceRequired" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.StateProvinceRequired"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.StateProvinceRequired"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.PhoneEnabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.PhoneEnabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.PhoneEnabled"></span>
    </div>
</div>
<div class="form-group" id="pnlCustomerPhoneRequired">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.PhoneRequired" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.PhoneRequired"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.PhoneRequired"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.FaxEnabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.FaxEnabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.FaxEnabled"></span>
    </div>
</div>
<div class="form-group" id="pnlCustomerFaxRequired">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.FaxRequired" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.FaxRequired"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.FaxRequired"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.AcceptPrivacyPolicyEnabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.AcceptPrivacyPolicyEnabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.AcceptPrivacyPolicyEnabled"></span>
    </div>
</div>
<div class="form-group">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.NewsletterEnabled" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.NewsletterEnabled"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.NewsletterEnabled"></span>
    </div>
</div>
<div class="form-group" id="pnlCustomerNewsletterTickedByDefault">
    <div class="col-8 col-md-4 col-sm-4 text-right">
        <admin-label asp-for="CustomerSettings.NewsletterTickedByDefault" class="control-label"/>
    </div>
    <div class="col-4 col-md-8 col-sm-8">
        <label class="mt-checkbox mt-checkbox-outline control control-checkbox">
            <admin-input asp-for="CustomerSettings.NewsletterTickedByDefault"/>
            <div class="control__indicator"></div>
        </label>
        <span asp-validation-for="CustomerSettings.NewsletterTickedByDefault"></span>
    </div>
</div>
</div>
</div>